

import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 经销商区域经理分页查询
export const searchRegionalManager = (_params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManager`, { params: _params, menuId: '-1' });


// 根据经销商区域经理ID 查询详情
export const getRegionalManagerById = (id, params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManager/${id}`, { params });


// 经销商区域经理新增
export const insertRegionalManager = params => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManager`, params);

// 经销商区域经理修改
export const updataRegionalManager = (params, id) => axios.put(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManager/${id}`, params);


// 所辖经销商列表
export const searchRegionalDealerManager = (_params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManagerDealer/batch/getAllList`, { params: _params, menuId: '-1' });

// 经销商区域经理-导出
export const exportExcel = params => {
  params = Object.assign(params, { menuId: '-1' });
  return axios({
    url: `${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManager/export/excel`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};

//经销商导入模板下载
export const getDealerExcelDemoList = params => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManagerDealer/export/excelDemo`, params, { responseType: 'arraybuffer' });

// 经销商区域经理下辖经销商-导出
export const exportExcelDealer = params => {
  params = Object.assign(params, { menuId: '-1' });
  return axios({
    url: `${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManagerDealer/export/excel`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};
// 获取员工认证信息
export const dealerAuthenticationList = (params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAuthentication/queryList`, { params });


// 经销商区域经理管辖范围修改
export const updateRegionalManagerJurisdiction = (params, id) => axios.put(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManagerJurisdiction/updateByManager/${id}`, params);


// 经销商区域经理管辖范围查询
export const searchRegionalManagerJurisdiction = (_params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManagerJurisdiction/getList/all`, { params: _params, menuId: '-1' });


// 查询组织树列表
export const getOrgDealerTree = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/manager/regionalManagerJurisdiction/getOrgDealer/tree`, { params });


